package com.miukoo.aikao.metadata.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.miukoo.aikao.core.dtos.PageReqDto;
import com.miukoo.aikao.core.dtos.PageResDto;
import com.miukoo.aikao.metadata.dto.SysRoleDto;
import com.miukoo.aikao.metadata.mapper.SysRoleMapper;
import com.miukoo.aikao.metadata.pojos.SysRole;
import com.miukoo.aikao.metadata.service.SysRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
* 语言设置 服务实现类
* </p>
*
* @author 聪明笨狗
* @since 2020-04-13 16:57
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {

    @Override
    public PageResDto<List<SysRole>> paging(PageReqDto<SysRoleDto> reqDto) {

        //创建分页对象
        IPage<SysRole> query = new Page<>(reqDto.getCurrent(), reqDto.getSize());

        //查询条件
        QueryWrapper<SysRole> wrapper = new QueryWrapper<>();

        //获得数据
        IPage<SysRole> page = this.page(query, wrapper);
        return PageResDto.result(page.getTotal(),page.getRecords());
     }
}
